import java.util.Random;

public class Main {
    private static double testStack(Stack<Integer> stack, int opCount) {
        long startTime = System.nanoTime();
        Random random = new Random();
        for (int i = 0; i < opCount; i++) {
            stack.push(random.nextInt(Integer.MAX_VALUE));
            random.nextInt();
        }
        for (int i = 0; i < opCount; i++) {
            stack.pop();
        }
        long endTime = System.nanoTime();
        return (endTime - startTime) / 1000000000.0;
    }

    public static void main(String[] args) {
        int opCount = 10000000;
        Stack<Integer> stack = new ArrayStack<>();
        double time1 = testStack(stack, opCount);
        System.out.println("ArrayStack,time:" + time1 + " s");
        stack = new LinkedListStack<>();
        double time2 = testStack(stack, opCount);
        System.out.println("LinkedListStack,time:" + time2 + " s");


    }
}
